package com.econ.powercloud.ems.controller;

import com.econ.powercloud.common.base.facade.pojo.MsgResult;
import com.econ.powercloud.ems.common.enums.SvgRelationType;
import com.econ.powercloud.ems.common.enums.SvgTypeEnum;
import com.econ.powercloud.ems.pojo.ApiDataVO;
import com.econ.powercloud.ems.service.biz.DictionaryApiBizService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author : zjf
 * @Description : 这里放那些无需token就可获取下拉框的数据接口
 * @Date : 2023/5/22 11:00
 * @Modified by : zjf
 */
@Api(tags = "数据字典无需token")
@RestController
@RequestMapping(value = "/api/v2/dictionary/withoutToken")
public class DataDictionaryWithoutTokenController extends ApiBaseController{

    @Autowired
    private DictionaryApiBizService dictionaryApiBizService;

    @ApiOperation("获取svg类型")
    @GetMapping("getSvgType")
    public MsgResult<List<ApiDataVO>> getSvgType() {
        List<ApiDataVO> list = dictionaryApiBizService.getApiDataVOList(SvgTypeEnum.values(), null);
        return successHandler(list);
    }

    @ApiOperation("获取svg关联类型")
    @GetMapping("getSvgRelationType")
    public MsgResult<List<ApiDataVO>> getSvgRelationType() {
        List<ApiDataVO> list = dictionaryApiBizService.getApiDataVOList(SvgRelationType.values(), null);
        return successHandler(list);
    }
}
